# set集合,对应java的set
# {}用来创建字典了,所有要用set()
# 无效,不重复,不支持下标
print('-----------创建集合----------------------')
set1 = set()
print(type(set1))

set2 = {10, 20, 30}
print(set2)

set3 = set('abcdefg')
print(set3)

print('---------------增加------------------')
set2.add(100)
set2.add(100)
print(set2)
# 追加的数据是序列
set2.update([300, 200])
print(set2)
set2.update((111, 222))
print(set2)
set2.update({333, 444})
set2.update('abc')
print(set2)
print('----------------删除-----------------')
set2 = {10, 20, 30}
# remove 删除失败会报错,discard不会报错
set2.remove(10)
# set2.remove(10)
print(set2)
set2.discard(20)
set2.discard(20)
print(set2)
s1 = {10, 20, 30, 40, 50}
s1.pop()
s1.pop()
print(s1)
set2.clear()
print(set2)
print('--------------查询数据-------------------')

s1 = {10, 20, 30, 40, 50}
print(10 in s1)
print(10 not in s1)
for key in s1:
    print(key)
print()
print('---------------------------------')
print()
